#include <iostream>
#include <string>
using namespace std;

class base
{
public:
    virtual void foo()
    {
        cout << "base::foo()" << endl;
    }
};

class derived: public base
{
public:
    // virtual 显示提示是函数, override 明确重载
    virtual void foo() override
    {
        cout << "derived::foo()" << endl;
    }
};


int main(int argc, char *argv[])
{
    base *p = new base();
    base *p1 = new derived();

    p->foo();
    p1->foo();

    return 0;
}

/* 结果:
base::foo()
derived::foo()

 */